package com.undsf.study7816.fatego.po.fgowiki;

import com.undsf.study7816.fatego.po.Servant;
import com.undsf.study7816.fatego.po.ServantClass;

/**
 * Created by Arathi on 2017/8/16.
 */
public class ServantModel {
    public String ID;
    public String NAME;
    public String NAME_JP;
    public String NAME_EN;
    public String PIC1;
    public String PIC2;
    public String PIC3;
    public String PIC4;
    public String PIC5;
    public String Avatar;
    public String STAR;
    public String CLASS;
    public String LV1_HP;
    public String LV1_ATK;
    public String LVMAX0_HP;
    public String LVMAX0_ATK;
    public String LVMAX1_HP;
    public String LVMAX1_ATK;
    public String LVMAX2_HP;
    public String LVMAX2_ATK;
    public String LVMAX3_HP;
    public String LVMAX3_ATK;
    public String LVMAX4_HP;
    public String LVMAX4_ATK;
    public String LV90_HP;
    public String LV90_ATK;
    public String LV100_HP;
    public String LV100_ATK;
    public String COST;
    public String ILLUST;
    public String CV;
    public String GLUTEN;
    public String DURABLE;
    public String AGILE;
    public String MAGIC;
    public String LUCKY;
    public String TREASURE;
    public String SKILL_R1;
    public String SKILL_P1;
    public String SKILL_L1;
    public String SKILL_C1;
    public String SKILL_E1;
    public String SKILL_R2;
    public String SKILL_P2;
    public String SKILL_L2;
    public String SKILL_C2;
    public String SKILL_E2;
    public String SKILL_R3;
    public String SKILL_P3;
    public String SKILL_L3;
    public String SKILL_C3;
    public String SKILL_E3;
    public String CSKILL_R1;
    public String CSKILL_P1;
    public String CSKILL_L1;
    public String CSKILL_E1;
    public String CSKILL_R2;
    public String CSKILL_P2;
    public String CSKILL_L2;
    public String CSKILL_E2;
    public String CSKILL_R3;
    public String CSKILL_P3;
    public String CSKILL_L3;
    public String CSKILL_E3;
    public String CSKILL_R4;
    public String CSKILL_P4;
    public String CSKILL_L4;
    public String CSKILL_E4;
    public String T_NAME;
    public String T_PROP;
    public String T_LEVEL;
    public String T_TYPE;
    public String T_EFFECT;
    public String CARD_BUSTER;
    public String CARD_ARTS;
    public String CARD_QUICK;
    public String INTRO1;
    public String INTRO2;
    public String INTRO3;
    public String INTRO4;
    public String INTRO5;
    public String INTRO6;
    public String INTRO7;
    public String Property;
    public String Camp;
    public String Crit;
    public String Death;
    public String CritPr;
    public String InitiativeNp;
    public String Passive;
    public String ArtHit;
    public String BusHit;
    public String QuiHit;
    public String EXHit;
    public String Height;
    public String Weight;
    public String Origin;
    public String Region;
    public String Attributes;
    public String Gender;
    public String T_Text_Arr;
    public String T_Num_Arr;
    public String S1LV;
    public String S2LV;
    public String S3LV;
    public String Skill_Name_Arr;
    public String Skill_Img_Arr;
    public String Skill_Border_Arr;
    public String Skill_Number_Arr;
    public String Skill_QP_Arr;
    public String Break_Name_Arr;
    public String Break_Img_Arr;
    public String Break_Border_Arr;
    public String Break_Number_Arr;
    public String Berak_QP_Arr;
    public String Circle;
    public String TdPointQ;
    public String TdPointA;
    public String TdPointB;
    public String TdPointEx;
    public String whereform;

    public static int ConvertToInteger(String value) {
        if (value == null || value.trim().isEmpty()) {
            return 0;
        }
        return Integer.parseInt(value);
    }

    public Servant toServant() {
        Servant servant = new Servant();
        servant.id = ConvertToInteger(ID);
        servant.name = NAME;
        String Class = CLASS.equals("Grand Caster") ? "GrandCaster" : CLASS;
        servant.Class = ServantClass.valueOf(Class);
        servant.rank = ConvertToInteger(STAR);
        servant.baseHP = ConvertToInteger(LV1_HP);
        servant.baseATK = ConvertToInteger(LV1_ATK);
        servant.cost = ConvertToInteger(COST);
        return servant;
    }
}
